<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<c:set var="ctx" value="${pageContext.request.contextPath}" />
<script type="text/javascript">
	ownerId = '${roomEvent.ownerId}';
	var resourceTree;
	$(function() {
		parent.$.modalDialog.ownerId = 1;
		$('#roleGrantForm').form({
			url : '${ctx}/roomSchedule/updateRoomEventNew',
			onSubmit : function() {
				progressLoad();
				var isValid = $(this).form('validate');
				if (!isValid) {
					progressClose();
				}
				if(isValid == true){
					var v = $('#eventStartTimeId').datetimebox('getValue');		         // 获取日期时间输入框的值
					var v2 = $('#eventEndTimeId').datetimebox('getValue');		         // 获取日期时间输入框的值
					
					if(v >= v2 ){
						progressClose();
						$.messager.alert('警告','起始时间要大于截止时间！');  
						return false;
					};
				}
				return isValid;
			},
			success : function(result) {
				progressClose();
				result = $.parseJSON(result);
				if (result.success) {
					parent.$.modalDialog.handler.dialog('close');
					parent.$.modalDialog.update.fullCalendar('refetchEvents');
				} else {
					parent.$.messager.alert('错误', result.msg, 'error');
				}
			}
		});
	});
</script>
<div id="roleGrantLayout" class="easyui-layout" data-options="fit:true,border:false">
	<div class="well well-small">
		<form id="roleGrantForm" method="post">
			<table>
				<tr>
					<td>预定人：</td>
					<td><input name="owner" type="text" disabled="true" class="easyui-validatebox span2" data-options="required:true" value="${roomEvent.owner}"></td>
				</tr>
				<tr>
					<td>主&nbsp;&nbsp;&nbsp;题：</td>
					<td><input <c:if test="${'${sessionInfo.loginName}' != 'admin'  && '${sessionInfo.id}' != '${roomEvent.ownerId}'} }">disabled="true"</c:if> name="title" type="text" class="easyui-validatebox span2" data-options="required:true" value="${roomEvent.title}">
					</td>
				</tr>
				<tr>
					<td>会议室：</td>
					<td><input name="roomName" type="text" class="easyui-validatebox span2" data-options="required:true" value="${roomEvent.roomName}">
					</td>
				</tr>
				<tr>
					<td>起始时间：</td>
					<td><input value="${roomEvent.start}" id="eventStartTimeId" name="start" class="easyui-datetimebox" data-options="required:true" style="width:150px"></td>
				</tr>
				<tr>
					<td>截止时间：</td>
					<td><input value="${roomEvent.end}" id="eventEndTimeId" name="end" class="easyui-datetimebox" data-options="required:true" style="width:150px"></td>
				</tr>
			</table>
			<input name="id" type="hidden" value="${roomEvent.id}">
			<!--  -->
			<input name="ownerId" type="hidden" value="${roomEvent.ownerId}">
			<!--  -->
			<input name="nowLogin" type="hidden" value="${sessionInfo.loginName}">
			<!--  -->
			<input name="nowLoginId" type="hidden" value="${sessionInfo.id}">
			<!--  -->
		</form>
	</div>
</div>